package com.yeyaomai.dksns.flowis.servlet;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.mongodb.core.query.Order;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import com.yeyaomai.dksns.flowis.domain.flowisdetail.FlowisQueryOrder;
import com.yeyaomai.dksns.flowis.domain.flowisdetail.FlowisStatDetailDTO;
import com.yeyaomai.dksns.flowis.service.FlowisQueryService;


/**
 * 
 * @author dingtao@yeyaomai.com
 *
 */

@Controller
@RequestMapping("/lately/*")
public class LatelyFlowisController {
	
	@Autowired
	FlowisQueryService  flowisQueryService;
	
	@RequestMapping(value = "/query")
	public String lately(HttpServletRequest request,HttpServletResponse response, FlowisQueryOrder order,
			ModelMap modelMap) {
		
		
	    order.addSort("access_date", Order.DESCENDING.toString());
	    
	    Page<FlowisStatDetailDTO>  result=	flowisQueryService.getSplit(order);
	    
		modelMap.addAttribute("result", result);

		modelMap.addAttribute("order", order);
		
	    
	    return  "search-lately";
		
		
	}

}
